<template>
    <el-table
        :data="centerData"
        max-height="500"
        :default-sort="{ prop: 'date', order: 'descending' }"
        stripe
        style="width: 100%"
        @row-click="check">
        <el-table-column prop="sub_time" label="日期" width="300" :formatter="formatDate" />
        <el-table-column prop="sub_title" label="标题" width="500" />
        <el-table-column prop="dic_value" label="审核状态" :formatter="formatter" />
    </el-table>
</template>

<script>
import _axios from '../axios/index';
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
export default {
    props: {
        centerData: {
            type: Array,
            required: true
        }
    },
    setup(props) {
        const router = useRouter();
        // function check(row){
        //     //alert(row.sub_id);
        //     router.push({path:'/check',query:{id:row.sub_id}});
        // }
        // return {
        //     check
        // }
        function formatDate(row, column, cellValue) {
            const date = new Date(cellValue);
            const year = date.getFullYear();
            const month = String(date.getMonth() + 1).padStart(2, '0');
            const day = String(date.getDate()).padStart(2, '0');
            const hours = String(date.getHours()).padStart(2, '0');
            const minutes = String(date.getMinutes()).padStart(2, '0');
            const seconds = String(date.getSeconds()).padStart(2, '0');
            return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
        }
        return {
            formatDate,
        }
    }
}
</script>

<style scoped>
</style>